import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { NestExpressApplication } from '@nestjs/platform-express';

async function bootstrap() {
    const app = await NestFactory.create<NestExpressApplication>(AppModule);
    const config = new DocumentBuilder()
        .setTitle('Test example')
        .setDescription('The API description')
        .setVersion('1.0')
        .addTag('test')
        .addBearerAuth({
            type: 'http',
            description: '基于 jwt 的认证',
            name: 'bearer'
        })
        .build();
    const document = SwaggerModule.createDocument(app, config);
    SwaggerModule.setup('doc', app, document);
    console.log("接口文档：http://localhost:3000/doc");
    app.useStaticAssets('static', { prefix: '/pages'});
    await app.listen(3000);
}
bootstrap();
